#include "STC89C5xRC.H"
#include "sys.h"

sbit DU = P2 ^ 0;
sbit WE = P2 ^ 1;
sbit CS88 = P2 ^ 2;
sbit DS1302 = P2 ^ 7;
sbit LCD1602 = P2 ^ 5;

static void delay1ms(void)
{
    unsigned char i, j;
    for (i = 0; i < 10; i++)
        for (j = 0; j < 33; j++)
            ;
}

void delay_us(uint8_t us)
{
    uint8_t i;
    for (i = 0; i < us; i++)
        ;
}

void delay_ms(uint8_t ms)
{
    unsigned char i;
    for (i = 0; i < ms; i++)
        delay1ms();
}

void hj_c52_reset(void)
{
    LCD1602 = 0;
    DS1302 = 0;
    CS88 = 0;
    WE = 1;
    P0 = 0Xff;
    WE = 0;
    CS88 = 0;
}